package com.hnevc.androiduiclassone7;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {
    EditText mEtMessage;
    Button mBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mEtMessage =  findViewById(R.id.et_message);
        mBtn = findViewById(R.id.btn_send);
        mBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this,
                        Main2Activity.class);
                intent.putExtra("data",mEtMessage.getText().toString());
                startActivity(intent);
            }
        });
    }
}
